<?php
/**
 * oscshop2 B2C电子商务系统
 *
 * ==========================================================================
 * @link      http://www.oscshop.cn/
 * @copyright Copyright (c) 2015-2017 oscshop.cn. 
 * @license   http://www.oscshop.cn/license.html License
 * ==========================================================================
 *
 * @author    李梓钿
 *
 * 用户注册验证
 */ 
namespace osc\mobile\validate;
use think\Validate;
class UserInfo extends Validate
{

/*
    $rule = [
        ['username','number|require|max:13','用户用户名码必填|必须是数字'],
        ['sharemobile','number|require|max:13','推荐人用户名码必填|必须是数字'],
        ['nikename','require|length:6,30|chsDash','用户昵称必填|长度6-30|必须汉字、字母、数字和下划线_'],
        ['password','require|length:6,32','密码必填|长度6-32'],
        ['2password','require|length:6,32','二级密码必填|长度6-32']
    ];

*/

    protected $rule = [
        'username' => 'require|alphaNum|length:11',
        'sharemobile' => 'require|alphaNum|different:service_code',
        'service_code' => 'require|alphaNum|different:sharemobile',
        'mobile'=>'require|different:username|number|length:11',
        'nickname' => 'require|length:1,30|chsDash',
        'password' => 'require|length:6,100',
        '2password' => 'require|length:6,100',
        'pwd2' => 'require|confirm:password',
        '2pwd2' => 'require|confirm:2password',
        'code' => 'require|number|length:6',
        'idcard' => ['/(^\d(15)$)|((^\d{18}$))|(^\d{17}(\d|X|x)$)/|require'],
        'idcard' => 'require|length:18',
        'idcardname' => 'require|length:2,30|chsDash',
        'bankaccount'=>'require|number|length:6,50',
        'bankname'=>'require|length:2,30|chsDash',
        'subbankname'=>'require|length:2,50|chsDash',
        'bankaccountname'=>'require|length:2,30|chsDash',
        'num'=> 'require|number|length:1,8',
        'trade_id'=> 'require|number|length:1,20',
        'sub_trade_id'=> 'require|number|length:1,20',
        'id'=> 'require|number|length:1,8',
        'token' => 'require|length:32|chsDash',
        'area'=> 'require',
        'delivery_cert1'=>'require|length:4,50',
        'delivery_cert2'=>'length:4,50',
        'delivery_cert3'=>'length:4,50'

    ];

    protected $message = [
        'delivery_cert1'=>'第一张凭证输入错误',
        'delivery_cert2'=>'第二张凭证输入错误',
        'delivery_cert3'=>'第三张凭证输入错误',
        'trade_id' => '交易所主账号输入不对',
        'sub_trade_id' => '交易副主账号输入不对',
        'username.require' => '用户名不能为空',
        'username.alphaNum' => '用户名不能为中文',
        'username.number' => '请输入正确的注册用户名',
        'username.length' => '用户名长度不能超过11位',
        'sharemobile.require' => '推荐人推荐码不能为空',
        'sharemobile.alphaNum' => '推荐人推荐码不能为中文',
        'sharemobile.different' => '推荐人推荐码不能与服务中心相同',
        'service_code.require' => '服务中心推荐码不能为空',
        'service_code.alphaNum' => '服务中心推荐码不能为中文',
        'service_code.different' => '服务中心推荐码不能与推荐人相同',
        'nickname.require' => '用户名不能为空',
        'nickname.length' => '用户名长度1-30',
        'nickname.chsDash' => '用户名必须汉字、字母、数字和下划线_',
        'password.require' => '密码不能为空',
        'password.length' => '密码长度不能小于6位,大于32位',
        'pwd2.require' => '请重复输入一次密码',
        'pwd2.confirm' => '两次密码输入不一致',
        '2password.require' => '二级密码密码不能为空',
        '2password.length' => '二级密码长度不能小于6位,大于32位',
        '2pwd2.require' => '请重复输入一次二级密码',
        '2pwd2.confirm' => '二级密码两次密码输入不一致',
        'code.require' => '验证码不能为空',      
        'code.number' => '验证码必须为数字',     
        'code.length' => '验证码输入不正确',
        'idcard'  => '非法身份证号，请仔细核实',
        'idcardname' =>'身份证名字输入有误',
        'bankaccount' =>'银行账户输入有误',
        'bankname' =>'开户行输入有误',
        'subbankname'=>'开户支行输入有误',
        'bankaccountname' =>'开户名称输入有误',
        'num'=>'数量输入有误',
        'id'=>'品种类型输入有误',
        'mobile'=>'用户名码输入有误',
        'token' => '非法请求',
        'area' =>'省市区信息不正确'
    ];

    protected $scene = [
        'login' => ['mobile', 'password'],
        'register' => ['username', 'sharemobile','service_code', 'nickname', 'password', '2password','pwd2','2pwd2'],
        'password' => ['password', 'repassword', 'token'],
        'update'=> ['mobile','password', 'repassword'],
        'find'=> ['username','password', 'pwd2','code'],
        'updatepasswd'=>['password', 'pwd2'],
        'update2passwd'=>['password','code','2password', '2pwd2'],
        'idcard'=>['idcard','idcardname','area'],
        'bank'=>['bankaccount','bankname','bankaccountname','subbankname'],
        'goldstone'=>['num','token'],
        'stone'=>['num','token','id'],
        'usertf'=>['num','mobile','token'],
        'ticket'=>['sub_trade_id','trade_id'],
        'delivery_cert'=>['delivery_cert1','delivery_cert2','delivery_cert3']
    ];
   

}
?>